using System;
using InfoJetSoft.Service.Entity;

namespace InfoJetSoft.Service.ManagedCode
{
	/// <summary>
	/// Summary description for TaskPanes.
	/// </summary>
	public class TaskPaneObject : Microsoft.Office.Interop.InfoPath.SemiTrust.TaskPaneObject
	{

		private Form form = null;
		private TaskPane taskPane = null;
		private bool visible = false;

		public TaskPaneObject( Form frm, TaskPane taskpane )
		{
			this.form = frm;
			this.taskPane = taskpane;
		}
		
		public bool Visible 
		{ 
			get
			{
				return false;
			}
			set
			{
				this.visible = value;
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.XdTaskPaneType TaskPaneType 
		{ 
			get
			{
				return Microsoft.Office.Interop.InfoPath.SemiTrust.XdTaskPaneType.xdTaskPaneHTML;
			}
		}

		public void Navigate( string url )
		{
			if( this.form.Manifest.TaskPaneList == null || this.form.Manifest.TaskPaneList.Count <= 0 )
			{
				this.form.TaskPane = new TaskPane();
				this.form.TaskPane.Caption = "TaskPane";
				this.form.TaskPane.Href = url;
			}
			else
			{
				TaskPane htmlTaskPane = (TaskPane)this.form.Manifest.TaskPaneList[0];
				this.form.TaskPane = new TaskPane();
				this.form.TaskPane.Caption = htmlTaskPane.Caption;
				this.form.TaskPane.Href = url;
			}
		}

	}
}
